package gstudio.mp3;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import de.zebee.mpa.ScannedMP3;

public class DoMp3CutFile {
	public boolean run(int start, int end, String inputMp3Path,
			String outputMp3Name) {
		try {
			InputStream in = new BufferedInputStream(new FileInputStream(
					inputMp3Path));
			ScannedMP3 sc = new ScannedMP3(in);

			InputStream in2 = new BufferedInputStream(new FileInputStream(
					inputMp3Path));

			OutputStream out = new BufferedOutputStream(new FileOutputStream(
					outputMp3Name));

			sc.crop(start, end + 200, in2, out);
			in.close();
			in2.close();
			out.close();
			return true;
		} catch (IOException e) {
			System.out.println("cut 出问题了");
			e.printStackTrace();
			return false;
		}

	}
}
